package chouxianlei;

abstract class alone{
    abstract void here_is_no_way();
}


abstract class zero {//抽象类就是用来被继承的,\
    //包含抽象方法的类时抽象类，要用abstract修饰
    String when;
    String where;

    zero(String where, String when) {
        this.where = where;
        this.when = when;
    }

    void hh() {
        System.out.println("hh");
    }

    abstract void Do();//被abstract修饰的方法不能有方法体

    abstract void hhh();
}

class One extends zero {
    String who;
    String do_what;

    public One(String where, String who, String do_what, String when) {
        super(where,when);
        this.who = who;
        this.do_what = do_what;
    }

    public void hhh() {//子类必重写父类的抽象方法

    }

    void Do() {
        System.out.println(who + ' ' + do_what + ' ' + where + ' ' + when);
    }

    void special() {
        System.out.println("One special");
    }

}
public class first {
    public static void main(String[] args) {
        //zero hh = new zero();//抽象类不能实例化
        zero hh = new One("school","hadage", "kaoshi", "afternoon");
        hh.Do();
        hh.hh();
        if (hh instanceof One) {
            One tmp = (One)hh;
            tmp.special();
        }
        zero hhh = new hhh("home","now");
        hhh.hhh();
        hhh.Do();
        //匿名对象
        new hhh("wowo","n").hhh();
        //没有名字，只能调用一次
    }
}
